unit NobraChatAcceptWin;
{
    Copyright 2008, travieorama@googlemail.com

    This file is part of the taviesadora project

    taviesadora is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    taviesadora is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.


}
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,ScktComp, ExtCtrls;

type
  TfrmAcceptNobraChat = class(TForm)
    btnYes: TButton;
    btnNo: TButton;
    btnBlock: TButton;
    lblMsg: TLabel;
    btnAlwaysYes: TButton;
    Timer1: TTimer;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btnYesClick(Sender: TObject);
    procedure btnNoClick(Sender: TObject);
    procedure btnBlockClick(Sender: TObject);
    procedure btnAlwaysYesClick(Sender: TObject);
  private
    NobraNetObj: TObject;
  public
    constructor Init(NobraNetObj: TObject; Msg: string);
  end;

var
  frmAcceptNobraChat_: TfrmAcceptNobraChat;

implementation

uses NobraClientThread;

{$R *.dfm}

{ TfrmAcceptNobraChat }

constructor TfrmAcceptNobraChat.Init(NobraNetObj: TObject; Msg: string);
begin
  //inherited create(Application);
  lblMsg.Caption := msg;
  self.NobraNetObj := NobraNetObj;
  show();
  SetForegroundWindow(Application.MainForm.Handle);
end;

procedure TfrmAcceptNobraChat.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin

  Action := caFree;
  if Assigned(NobraNetObj) then
     if NobraNetObj is TConData then
        (NobraNetObj as TConData).SetfrmChatAcceptAnswer(nil);
 // frmAcceptNobraChat := nil;
end;

procedure TfrmAcceptNobraChat.btnYesClick(Sender: TObject);
begin
  if Assigned(NobraNetObj) then
     if NobraNetObj is TConData then
        (NobraNetObj as TConData).SetChatAcceptAnswer(ncaYes);
  Close;
end;

procedure TfrmAcceptNobraChat.btnAlwaysYesClick(Sender: TObject);
begin
  if Assigned(NobraNetObj) then
     if NobraNetObj is TConData then
        (NobraNetObj as TConData).SetChatAcceptAnswer(ncaAlwaysYes);
  Close;
end;

procedure TfrmAcceptNobraChat.btnNoClick(Sender: TObject);
begin
  if Assigned(NobraNetObj) then
     if NobraNetObj is TConData then
        (NobraNetObj as TConData).SetChatAcceptAnswer(ncaNo);
  Close;
end;

procedure TfrmAcceptNobraChat.btnBlockClick(Sender: TObject);
begin
  if Assigned(NobraNetObj) then
     if NobraNetObj is TConData then
        (NobraNetObj as TConData).SetChatAcceptAnswer(ncaBlock);
  Close;
end;



end.
